// Copyright 2006 PR1ME. All Rights Reserved.

public class SuperCluster extends Cluster {

  public SuperCluster(String descriptor, Cluster[] subClusters) {
    super(descriptor);
    this.subClusters = subClusters;
  }

  public Cluster getSubcluster(int index) {
    if (index < 0 || index >= subClusters.length) {
      return null;
    }
    return subClusters[index];
  }

  public SuperCluster isSuperCluster() {
    return this;
  }

  private final Cluster[] subClusters;

  public String[] getItems() {
    String[] results = new String[subClusters.length];
    for (int i = 0; i < subClusters.length; ++i) {
      results[i] = subClusters[i].getDescriptor();
    }
    return results;
  }

}
